Skip to content

web/bugc-react: add curated example selector to the docs BugPlayground#247

Open
gnidan wants to merge 1 commit into
mainfrom
architect-bug-example-selector
Open

web/bugc-react: add curated example selector to the docs BugPlayground#247
gnidan wants to merge 1 commit into
mainfrom
architect-bug-example-selector

Conversation

@gnidan

@gnidan gnidan commented Jul 10, 2026

Copy link
Copy Markdown
Member

The docs BugPlayground only ever showed one program; the example
picker lived in the standalone packages/playground app. This ports a
lean version into the docs widget.

  • bugc-react: add a curated bugExamples set (Counter, Function
    calls, Arrays & loops) as a reusable export. Sources are distilled
    from packages/bugc/examples and stripped of the /*@test*/
    behavioral annotations the raw files carry, so they read cleanly in
    an editor. examples.test.ts asserts each compiles to bytecode
    without errors (guards against a typo in an inlined source); adds the
    missing vitest.config.ts so the package's test script runs.
  • web BugPlayground: add an optional examples prop (defaults to
    bugExamples) and an Example dropdown in the header controls. The
    selector shows only when no initialCode is passed — so the bare
    playground page gains it while inline single-example doc embeds stay
    unchanged. Selecting an example loads its source and recompiles.

Additive; no dependency on the transform-context work. Example sources
are verified to compile via the new tests; the UI wiring mirrors the
existing optimizer selector.

#243)

The docs BugPlayground only ever showed one program; the example
picker lived in the standalone packages/playground app. Port a lean
version into the docs widget (gnidan #33).

- bugc-react: add a curated `bugExamples` set (Counter, Function calls,
  Arrays & loops) as a reusable export. Sources are distilled from
  packages/bugc/examples and stripped of the `/*@test*/` behavioral
  annotations the raw files carry, so they read cleanly in an editor.
  examples.test.ts asserts each compiles to bytecode without errors
  (guards against a typo in an inlined source); adds the missing
  vitest.config.ts so the package's test script runs.
- web BugPlayground: add an optional `examples` prop (defaults to
  bugExamples) and an Example dropdown in the header controls. The
  selector shows only when no `initialCode` is passed — so the bare
  playground page gains it while inline single-example doc embeds stay
  unchanged. Selecting an example loads its source and recompiles.

Additive; does not affect the tracer or #227. Example sources verified
to compile via the new tests; UI wiring mirrors the existing optimizer
selector.
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://ethdebug.github.io/format/pr-preview/pr-247/

Built to branch gh-pages at 2026-07-10 00:55 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant